import request from "@/utils/request";

/**
 * 获取员工下拉列表
 * @param {*} data
 * @returns
 */
export function getSimple() {
  return request({
    url: "/sys/user/simple",
  });
}

/**
 * @description: 获取员工列表
 * @param {*} params {page:当前页,size：每页条数}
 * @return {*}
 */
export function getEmployeeList(page, size) {
  return request({
    methods: "get",
    url: "/sys/user",
    params: { page, size },
  });
}

/**
 * @description: 删除员工
 * @param {*} id 员工id
 * @return {*}
 */
export function delEmployee(id) {
  return request({
    method: "delete",
    url: `/sys/user/${id}`,
  });
}

/**
 * 新增员工
 * @param {*} data
 * @returns
 */
export function addEmployee(data) {
  return request({
    url: "/sys/user",
    method: "post",
    data,
  });
}

export function importEmployee(data) {
  return request({
    url: "/sys/user/batch",
    method: "post",
    data,
  });
}

/**
 * @description: 保存员工信息
 * @param {*} data
 * @return {*}
 */
export function saveUserDetailById(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: "put", // 全量修改
    data,
  });
}
